#include "DevParamFile.h"

#include "ComStruct.h"
//#include "AppDefine.h"
#include "DevParamField.h"
#include "ReadWriteParam.h"

CDevParamFile::CDevParamFile()
{

}

CDevParamFile::~CDevParamFile()
{
    Clear();
}

CDevParamFile::CDevParamFile(const CDevParamFile& that)
{
    if (this == &that)
    {
        return;
    }

    CopyFrom(&that);
}

CDevParamFile& CDevParamFile::operator=(const CDevParamFile& that)
{
    if (this != &that)
    {
        CopyFrom(&that);
    }

    return *this;
}

void CDevParamFile::CopyFrom(const CDevParamFile* pthat)
{
    if (0 == pthat)
    {
        return;
    }

    m_listReadPages = pthat->m_listReadPages;
    m_listReadDataCount = pthat->m_listReadDataCount;
    m_listWritePages = pthat->m_listWritePages;
    m_listWriteDataCount = pthat->m_listWriteDataCount;
    m_iIntCount = pthat->m_iIntCount;
    m_iFloatCount = pthat->m_iFloatCount;
}

void CDevParamFile::Clear()
{
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    m_iIntCount = 0;
    m_iFloatCount = 0;
}

bool CDevParamFile::operator==(const CDevParamFile& that) {
    // 防止自身比较
    if (this == &that) return true;

    //任何一个变量值不等，都返回false
    if (this->m_listReadPages != that.m_listReadPages) return false;
    if (this->m_listReadDataCount != that.m_listReadDataCount) return false;
    if (this->m_listWritePages != that.m_listWritePages) return false;
    if (this->m_listWriteDataCount != that.m_listWriteDataCount) return false;
    if (this->m_iIntCount != that.m_iIntCount) return false;
    if (this->m_iFloatCount != that.m_iFloatCount) return false;

    // 以上变量值都相等，返回true
    return true;
}

bool CDevParamFile::operator!=(const CDevParamFile& that) {
    return (!(*this == that));
}

//验证变量的值范围(小于最小值则取最小值，大于最大值则取最大值)
void CDevParamFile::CheckIntRange(int& iValue, int iMinValue, int iMaxValue)
{
    if (iValue < iMinValue) {
        //最小值
        iValue = iMinValue;
    } else if (iValue > iMaxValue) {
        //最大值
        iValue = iMaxValue;
    }
}

void CDevParamFile::AddIntField(const QString& strKey, const QString& strShowName, const QString& strDefaultName /*= ""*/, const QString& strDefaultValue /*= ""*/)
{
    CDevParamField* pField = 0;
    if (ExistField(strKey))
    {
        pField = GetFieldByKey(strKey);
    }
    else
    {
        pField = new CDevParamField();
    }

    if (0 != pField)
    {
        pField->InitInt(strKey, strShowName, strDefaultName, strDefaultValue);

        m_mapFields[strKey] = pField;
    }
}

void CDevParamFile::AddFloatField(const QString& strKey, const QString& strShowName, const QString& strDefaultName /*= ""*/, const QString& strDefaultValue /*= ""*/)
{
    CDevParamField* pField = 0;
    if (ExistField(strKey))
    {
        pField = GetFieldByKey(strKey);
    }
    else
    {
        pField = new CDevParamField();
    }

    if (0 != pField)
    {
        pField->InitFloat(strKey, strShowName, strDefaultName, strDefaultValue);

        m_mapFields[strKey] = pField;
    }
}

bool CDevParamFile::ExistField(const QString& strKey)
{
    return m_mapFields.contains(strKey);
}

CDevParamField* CDevParamFile::CheckField(const QString& strKey)
{
    if (ExistField(strKey))
    {
        return m_mapFields.value(strKey);
    }
    else
    {
        CDevParamField* pField = new CDevParamField();
        pField->SetKey(strKey);

        m_mapFields[strKey] = pField;

        return pField;
    }

    return 0;
}

CDevParamField* CDevParamFile::GetFieldByKey(const QString& strKey)
{
    if (ExistField(strKey))
    {
        return m_mapFields.value(strKey);
    }

    return 0;
}

CDevParamField* CDevParamFile::GetField(int iDataType, int iFieldIndex)
{
    QList<CDevParamField*> listFields;
    listFields = GetFieldList(iDataType);
    if (listFields.isEmpty())
    {
        return 0;
    }

    if (iFieldIndex >= 0 && iFieldIndex < listFields.count())
    {
        return listFields.at(iFieldIndex);
    }
    else
    {
        return 0;
    }
}

//读空调的配置
void CDevParamFile::ReadAcFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("AC-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("AC-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("AC-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("AC-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("AC-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("AC-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    int iUpdate = 0;
    QString strUnit = "";
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("AC-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("AC-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("AC-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("AC-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("AC-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("AC-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("AC-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("AC-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("AC-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("AC-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读液冷的配置
void CDevParamFile::ReadLcFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("LC-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("LC-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("LC-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("LC-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("LC-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("LC-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("LC-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("LC-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("LC-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("LC-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("LC-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("LC-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("LC-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("LC-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("LC-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("LC-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读除湿的配置
void CDevParamFile::ReadDryFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("DH-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("DH-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("DH-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("DH-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("DH-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("DH-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("DH-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("DH-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("DH-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("DH-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("DH-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("DH-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("DH-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("DH-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("DH-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("DH-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读环控的配置
void CDevParamFile::ReadEnvCtrlFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("HK-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("HK-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("HK-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("HK-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("HK-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("HK-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("HK-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("HK-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("HK-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("HK-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("HK-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("HK-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("HK-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("HK-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("HK-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("HK-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读消防的配置
void CDevParamFile::ReadFireFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("XF-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("XF-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("XF-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("XF-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("XF-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("XF-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("XF-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("XF-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("XF-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("XF-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("XF-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("XF-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("XF-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("XF-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("XF-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("XF-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读水浸的配置
void CDevParamFile::ReadWaterFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("WS-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("WS-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("WS-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("WS-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("WS-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("WS-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("WS-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("WS-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("WS-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("WS-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("WS-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("WS-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("WS-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("WS-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("WS-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("WS-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读PCS逆变器的配置
void CDevParamFile::ReadPcsFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("PCS-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("PCS-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("PCS-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("PCS-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("PCS-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("PCS-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("PCS-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("PCS-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("PCS-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("PCS-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("PCS-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("PCS-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("PCS-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("PCS-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("PCS-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("PCS-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读电表的配置
void CDevParamFile::ReadMeterFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("EM-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("EM-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("EM-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("EM-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("EM-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("EM-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("EM-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("EM-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("EM-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("EM-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("EM-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("EM-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("EM-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("EM-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("EM-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("EM-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读温湿度的配置
void CDevParamFile::ReadThFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("TH-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("TH-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("TH-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("TH-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("TH-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("TH-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("TH-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("TH-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("TH-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("TH-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("TH-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("TH-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("TH-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("TH-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("TH-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("TH-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读门禁的配置
void CDevParamFile::ReadEgFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("MJ-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("MJ-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("MJ-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("MJ-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("MJ-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("MJ-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("MJ-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("MJ-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("MJ-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("MJ-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("MJ-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("MJ-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("MJ-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("MJ-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("MJ-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("MJ-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读Dcdc的配置
void CDevParamFile::ReadDcdcFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("DCDC-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("DCDC-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("DCDC-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("DCDC-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("DCDC-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("DCDC-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("DCDC-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("DCDC-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("DCDC-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("DCDC-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("DCDC-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("DCDC-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("DCDC-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("DCDC-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("DCDC-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("DCDC-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读充电桩的配置
void CDevParamFile::ReadCpFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("CDZ-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("CDZ-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("CDZ-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("CDZ-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("CDZ-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("CDZ-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("CDZ-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("CDZ-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("CDZ-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("CDZ-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("CDZ-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("CDZ-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("CDZ-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("CDZ-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("CDZ-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("CDZ-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读可燃气体的配置
void CDevParamFile::ReadGasFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("GAS-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("GAS-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("GAS-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("GAS-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("GAS-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("GAS-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("GAS-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("GAS-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("GAS-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("GAS-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("GAS-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("GAS-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("GAS-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("GAS-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("GAS-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("GAS-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读输入输出的配置
void CDevParamFile::ReadIoFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("IO-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("IO-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("IO-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("IO-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("IO-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("IO-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("IO-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("IO-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("IO-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("IO-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("IO-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("IO-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("IO-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("IO-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("IO-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("IO-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

//读UPS的配置
void CDevParamFile::ReadUpsFields(int iDevIndex)
{
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> iBegin(m_mapFields);
    while (iBegin.hasNext())
    {
        iBegin.next();

        pField = iBegin.value();
        if (0 != pField)
        {
            pField->SetShowName(""); //先设置之前的字段的名称为空
        }
    }

    // read BA10Temp.ini
    QSettings setFile("../ini/BA10Temp.ini", QSettings::IniFormat);
    setFile.setIniCodec("UTF-8");

    //Type：0~9读;10~19写
    m_listReadPages.clear();
    m_listReadDataCount.clear();
    m_listWritePages.clear();
    m_listWriteDataCount.clear();
    QString strKey = "";
    QString strName = "";
    int iFieldCount = 0;
    for (int i = 0; i < 10; ++i)
    {
        // ReadPage0_Name=
        strKey = QString("UPS-%1/ReadPage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listReadPages.append(strName);
        }

        // ReadPage0_Cnt=
        strKey = QString("UPS-%1/ReadPage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 99)
        {
            m_listReadDataCount.append(iFieldCount);
        }

        // WritePage0_Name=
        strKey = QString("UPS-%1/WritePage%2_Name").arg(iDevIndex+1).arg(i);
        strName = setFile.value(strKey, "").toString();
        if (!strName.isEmpty())
        {
            m_listWritePages.append(strName);
        }
        // WritePage0_Cnt=
        strKey = QString("UPS-%1/WritePage%2_Cnt").arg(iDevIndex+1).arg(i);
        iFieldCount = setFile.value(strKey, "").toInt();
        if (iFieldCount >0 && iFieldCount <= 100)
        {
            m_listWriteDataCount.append(iFieldCount);
        }
    }

    strKey = QString("UPS-%1/uRev_Cnt").arg(iDevIndex+1);
    m_iIntCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iIntCount, 0, 99);
    strKey = QString("UPS-%1/fRev_Cnt").arg(iDevIndex+1);
    m_iFloatCount = setFile.value(strKey, "").toInt();
    CheckIntRange(m_iFloatCount, 0, 100);

    QString strUnit = "";
    int iUpdate = 0;
    int iType = 0;
    QString strLine = "";
    for (int i = 0; i < m_iIntCount; ++i)
    {
        strKey = "uRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToInt();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("UPS-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("UPS-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("UPS-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("UPS-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("UPS-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    for (int i = 0; i < m_iFloatCount; ++i)
    {
        strKey = "fRev" + QString("%1").arg(i).rightJustified(2, '0');
        pField = CheckField(strKey);
        if (0 != pField)
        {
            pField->SetValueTypeToFloat();
            pField->SetValueIndex(i);

            //读字段的名称
            strName = setFile.value(QString("UPS-%1/%2_Name").arg(iDevIndex+1).arg(strKey), "").toString();
            if (strName.isEmpty())
            {
                m_mapFields.remove(strKey);
                delete pField;
                pField = 0;
                continue;
            }
            pField->SetShowName(strName);

            //读字段的单位
            strUnit = setFile.value(QString("UPS-%1/%2_Unit").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->SetUnit(strUnit);

            //读字段的更新类型
            iUpdate = setFile.value(QString("UPS-%1/%2_Update").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetUpdateType(iUpdate);

            //读字段的数据类型
            iType = setFile.value(QString("UPS-%1/%2_Type").arg(iDevIndex+1).arg(strKey), "").toInt();
            pField->SetDataType(iType);

            //读字段的值列表
            //Reserve0_ValueList=<0:关机><1:送风><2:制冷><3:加热><4:除湿>
            strLine = setFile.value(QString("UPS-%1/%2_ValueList").arg(iDevIndex+1).arg(strKey), "").toString();
            pField->ParseValueList(strLine);

            m_mapFields[strKey] = pField;
        }
    }

    QMapIterator<QString, CDevParamField*> iEnd(m_mapFields);
    while (iEnd.hasNext())
    {
        iEnd.next();

        strKey = "";
        pField = 0;
        strKey = iEnd.key();
        pField = iEnd.value();

        if (0 != pField && pField->GetShowName().isEmpty())
        {
            //修改参数后,删除空参数
            delete pField;
            pField = 0;
            m_mapFields.remove(strKey);
        }
    }
}

QMap<int, QString> CDevParamFile::GetMapValues(const QString& strKey)
{
    if (ExistField(strKey))
    {
        return m_mapFields.value(strKey)->GetMapValues();
    }
    else
    {
        QMap<int, QString> ret;
        return ret;
    }
}

QList<QPair<int, QString> > CDevParamFile::GetListValues(const QString& strKey)
{
    if (ExistField(strKey))
    {
        return m_mapFields.value(strKey)->GetListValues();
    }
    else
    {
        QList<QPair<int, QString> > ret;
        return ret;
    }
}

QString CDevParamFile::GetIntText(const QString& strKey, int ivalue)
{
    if (ExistField(strKey))
    {
        return m_mapFields.value(strKey)->GetIntText(ivalue);
    }
    else
    {
        return "";
    }
}

int CDevParamFile::GetFieldCount(int iDataType)
{
    int iFieldCount = 0;
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> i(m_mapFields);
    while (i.hasNext())
    {
        i.next();

        pField = i.value();
        if (0 != pField && iDataType == pField->GetDataType())
        {
            iFieldCount++;
        }
    }

    int iPageCount = 0;
    if (iDataType >= 0 && iDataType < 10)
    {
        iPageCount = GetReadPageDataCount(iDataType);
    }
    else if (iDataType >= 10 && iDataType < 20)
    {
        iPageCount = GetWritePageDataCount(iDataType - 10);
    }

    return qMin(iFieldCount, iPageCount);
}

QList<CDevParamField*> CDevParamFile::GetFieldList(int iDataType)
{
    int iFieldCount = GetFieldCount(iDataType);
    QList<CDevParamField*> listFields;
    CDevParamField* pField = 0;
    QMapIterator<QString, CDevParamField*> i(m_mapFields);
    while (i.hasNext())
    {
        i.next();

        pField = i.value();
        if (0 != pField && iDataType == pField->GetDataType() && listFields.count() < iFieldCount)
        {
            listFields.append(pField);
        }
    }

    return listFields;
}

int CDevParamFile::GetReadPageCount()
{
    return qMin(m_listReadPages.count(), m_listReadDataCount.count());
}

QString CDevParamFile::GetReadPageName(int iReadType)
{
    int iindex = iReadType - CReadWriteParam::READ_PARAM1;
    if (iindex < 0 || iindex >= 10)
    {
        return "";
    }

    if (iindex >= m_listReadPages.count())
    {
        return "";
    }

    return m_listReadPages.at(iindex);
}

int CDevParamFile::GetReadPageDataCount(int iindex)
{
    if (iindex < 0 || iindex >= 10)
    {
        return 0;
    }

    if (iindex >= m_listReadDataCount.count())
    {
        return 0;
    }

    return m_listReadDataCount.at(iindex);
}

int CDevParamFile::GetWritePageCount()
{
    return qMin(m_listWritePages.count(), m_listWriteDataCount.count());
}

QString CDevParamFile::GetWritePageName(int iWriteType)
{
    int iindex = iWriteType - CReadWriteParam::WRITE_PARAM1;
    if (iindex < 0 || iindex >= 10)
    {
        return "";
    }

    if (iindex >= m_listWritePages.count())
    {
        return "";
    }

    return m_listWritePages.at(iindex);
}

int CDevParamFile::GetWritePageDataCount(int iindex)
{
    if (iindex < 0 || iindex >= 10)
    {
        return 0;
    }

    if (iindex >= m_listWriteDataCount.count())
    {
        return 0;
    }

    return m_listWriteDataCount.at(iindex);
}

bool CDevParamFile::HasReadPage()
{
    int icount = GetReadPageCount();
    for (int i = 0; i < icount; ++i)
    {
        if (m_listReadDataCount.at(i) > 0)
        {
            return true;
        }
    }

    return false;
}

bool CDevParamFile::HasWritePage()
{
    int icount = GetWritePageCount();
    for (int i = 0; i < icount; ++i)
    {
        if (m_listWriteDataCount.at(i) > 0)
        {
            return true;
        }
    }

    return false;
}

bool CDevParamFile::HasReadWritePage()
{
    return HasReadPage() || HasWritePage();
}

int CDevParamFile::GetIntCount()
{
    return m_iIntCount;
}

int CDevParamFile::GetFloatCount()
{
    return m_iFloatCount;
}
